/***********     system   start     **********/
//机构等级
var getOrgLevelTrees =
    [
        {name:"一级",id:1},
        {name:"二级",id:2},
        {name:"三级",id:3},
        {name:"四级",id:4},
        {name:"五级",id:5},
        {name:"六级",id:6}
    ];

function getOrgLevelName(val) {
    var data = "";
    val = parseInt(val);
    if(val == 1){
        data = "一级";
    }else if(val == 2){
        data = "二级";
    }else if(val == 3){
        data = "三级";
    }else if(val == 4){
        data = "四级";
    }else if(val == 5){
        data = "五级";
    }else if(val == 6){
        data = "六级";
    }
    return data;
}

// 机构类型
var getOrgTypeTrees =
    [
        {name:"单位",id:1},
        {name:"区域范围",id:2},
        {name:"服务区",id:3},
        {name:"商户",id:4}
    ];

function getOrgTypeName(val) {
    var data = "";
    val = parseInt(val);
    if(val == 1){
        data = "单位";
    }else if(val == 2){
        data = "区域范围";
    }else if(val == 3){
        data = "服务区";
    }else if(val == 4){
        data = "商户";
    }
    return data;
}

// 故障单状态
var faultFormStatus =
    [
        {name:"编制",id:1},
        {name:"维护所审核",id:2},
        {name:"维护所审核未通过",id:3},
        {name:"桥隧所审核",id:4},
        {name:"桥隧所审核未通过",id:5},
        {name:"维修中",id:6},
        {name:"已修复",id:7},
        {name:"已删除",id:8},
        {name:"待维修",id:9}
    ];

/***********     system   end     ************/

/***********     region   start     **********/
// 行政区等级
var regionLevelTrees =
    [
        {name:"省级行政区(一级)",id:1},
        {name:"地级行政区(二级)",id:2},
        {name:"县级行政区(三级)",id:3},
        {name:"乡级行政区(四级)",id:4}
    ];

// 一级行政区管辖类型
var regionType_1_Trees =
    [
        {name:"省",id:1},
        {name:"自治区",id:2},
        {name:"直辖市",id:3}
    ];

// 二级行政区管辖类型
var regionType_2_Trees =
    [
        {name:"地级市",id:4},
        {name:"地区",id:5},
        {name:"自治州",id:6}
    ];

// 三级行政区管辖类型
var regionType_3_Trees =
    [

        {name:"市辖区",id:7},
        {name:"县",id:8},
        {name:"自治县",id:9},
        {name:"特区",id:10},
    ];

// 四级行政区管辖类型
var regionType_4_Trees =
    [
        {name:"镇",id:11},
        {name:"乡",id:12}
    ];


var regionLevelOptions =
    [
        {text:"省级行政区(一级)",value:1},
        {text:"地级行政区(二级)",value:2},
        {text:"县级行政区(三级)",value:3},
        {text:"乡级行政区(四级)",value:4}
    ];

// 所有的区域类型
var regionTypeAllOptions =
    [
        {text:"省",value:1},
        {text:"自治区",value:2},
        {text:"直辖市",value:3},
        {text:"地级市",value:4},
        {text:"地区",value:5},
        {text:"自治州",value:6},
        {text:"市辖区",value:7},
        {text:"县",value:8},
        {text:"自治县",value:9},
        {text:"特区",value:10},
        {text:"镇",value:11},
        {text:"乡",value:12}
    ];
/***********     region   end     **********/



//---------------------------  以上为最新数据  ----------------------

var commonStatusOptions = [{text:"启用",value:1}, {text:"禁用",value:0}];
var sexStatusOptions = [{text:"男",value:1}, {text:"女",value:2}];
var accountMonthTypeOptions = [{text:"本月",value:1},{text:"上月",value:2}, {text:"下月",value:3}];

var storeFormOptions =[
    {text:"初稿",value:1},
    {text:"待审核",value:2},
    {text:"待处理",value:3},
    {text:"待验收",value:4},
    {text:"已完成",value:5},
    {text:"删除",value:6},
    {text:"区长审核失败",value:7},
    {text:"区长验收失败",value:8}
];

var statisCompleteOptions =[
    {text:"未完成",value:1},
    {text:"已完成",value:2}
];

//任务状态
var tStatusOptions =[
    {text:"未处理",value:0}, {text:"审核通过",value:1}, {text:"审核未通过",value:2},
    {text:"已被其他主办人处理",value:3},{text:"处理中",value:4}, {text:"处理完成",value:5},
    {text:"故障单编辑",value:6}, {text:"故障单删除",value:7},
    {text:"故障单转交到维护所审核",value:8},{text:"故障单维护所审核成功",value:9},{text:"故障单桥隧所审核失败",value:10},
    {text:"故障单转交到桥隧所审核",value:11},{text:"故障单桥隧所审核成功",value:12},{text:"故障单桥隧所审核失败",value:13},
    {text:"故障单转交到设备维修",value:14},{text:"故障单设备已修复",value:15}

];

function getOptionText(option,columnValue) {
    var text="";
    $.each(option,function (i, item) {
        if (item.value === columnValue){
            text = item.text;
            return false;
        }
    });
    return text;
}

//获取消息跳转对象
function getForwarderDatas(id,tID,content) {
	var url = "";
	if(id == 2 || id == 3 || id == 4){
		url = "pages/emms/totalPlan/totalPlanAudit.jsp?menuID=164&fromMsg=true&tID="+tID;
	}else if(id == 43){
        url = "pages/emms/totalPlan/totalPlanMgr.jsp?menuID=162&fromMsg=true&tID="+tID;
    }else if(id == 11 || id == 12 || id==61 || id==13){
        url = "pages/emms/monPlan/monPlanAudit.jsp?menuID=258&fromMsg=true&tID="+tID;
    }else if(id == 46){
        url = "pages/emms/monPlan/monPlanMgr.jsp?menuID=257&fromMsg=true&tID="+tID;
    }else if(id == 39){
        url = "pages/emms/procplan/procplanPlans.jsp?flowNodeID=39&menuID=313&fromMsg=true&tID="+tID;
    }else if(id == 52){
        url = "pages/emms/procplan/procplanPlans.jsp?flowNodeID=52&menuID=307&fromMsg=true&tID="+tID;
    }else if(id == 34){
        url = "pages/emms/oosform/oosformAudit/oosformAuditMgr.jsp?menuID=302&fromMsg=true&tID="+tID;
    }else if(id == 55){
        url = "pages/emms/oosform/errorRecoveryOosform/errorRecoveryOosformMgr.jsp?menuID=301&fromMsg=true&tID="+tID+"&content="+content;
    }else if(id == 20){
        url = "pages/emms/putInStorageMgr/materialAdmissionAudit.jsp?menuID=277&fromMsg=true&tID="+tID;
    }else if(id == 58){
        url = "pages/emms/putInStorageMgr/materialStorageToCorrect.jsp?menuID=281&fromMsg=true&tID="+tID+"&content="+content;
    }
    // alert(url);
	return url;
}
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg); //匹配目标参数
    if (r != null) return unescape(r[2]); return null; //返回参数值
}

function getImgText(imgsData) {
    var imgList = "";
    if(imgsData){
        var imgsArr = imgsData.split(",");

        if(imgsArr.length>0){

            for(var i=0;i<imgsArr.length;i++){
                imgList +='<a class="chakan" href="'+basePath+'/filesManager/showFile?url='+imgsArr[i]+'"><img src="'+basePath+'/filesManager/showFile?url='+imgsArr[i]+'"/></a>';
            }
        }
    }

    return imgList;
}

